package com.four.marketing.controller;

import com.four.marketing.dao.GroupMapper;
import com.four.marketing.entity.Group;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

/**
 * @Author:wsy
 * @Date: 2021/12/16/14:12
 * @Description
 */
@Configuration
public class RabbitMqController {

    @Autowired
    private GroupMapper groupMapper;

    @RabbitListener(queues = "order-cunsume")
    @RabbitHandler
    public void getMsg(Integer id){
        Group group=groupMapper.selectGroupById(id);
        if(group.getGroStatus().equals(0)){
            group.setGroStatus(1);
        }
        groupMapper.updateGroupStatus(group,id);
    }
}
